package org.blogwu.learn.arithmetic.demo1;

public class Main {
    public static void main(String[] args) {
//        Interx.i=6;
        System.out.println(Interx.i);

//        int[] da = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
//
//        System.out.println(searchNum(1, da));
    }


    public static int searchNum(int num, int[] da) {
        int low = 0;
        int high = da.length - 1;
        int mid = 0;//二分的数组下标

        while (low <= high) {

            // 第一步，先取中间的
            mid = ((high + low) / 2);
            System.out.println(mid);
            if (da[mid] == num) {
                return mid;
            }
            if (da[mid] > num) {
                high = mid - 1;

            }
            if (da[mid] < num) {
                low = mid + 1;
            }
        }
        return -1;
    }

}

//0,1,2,3,4,5 查5
//low 0 hi 5
//low 3 hi 5
//low 5 hi 5
